$(function () {
	$.ajax({
		type: 'post', //HTTP请求类型
		url: "/book/front/book.action?methodName=queryBooks&time="+ new Date(),
		dataType: 'json', //服务器返回json格式数据
		data: {},
		success: function(responseText) {
			window.console.log(responseText.msg)
			switch (responseText.msg) {
				case "success":
					//遍历展示数据
					$.each(responseText.data, function(index, book) {
						let row = ""
						let state = ""
						if (book.state == 1) {
							state = "连载中"
						} else {
							state = "已完结"
						}
						row += '<li>' +
							'<a class="book commonbook" href="1074345.html" target="_blank" onclick="to()">' +
							'<img src="' + book.cover + '">' +
							'</a>' +
							'<div class="info">' +
							'<h4>' +
							'<a href="1074345.html" target="_blank" id="name" onclick="to()" value="' + book.uuid + '">' + book.name +
							'</a>' +
							'<span class="subtitle">' +
							'<i class="iconfont">&#xe604;</i>' +
							'<a target="_blank" href="javascript:;">' + book.author + '</a>' +
							'<a target="_blank" href="2.html">' + book.category.categoryName + '</a>' +
							'<span>' + state + '</span>' +
							'</span>' +
							'</h4>' +
							'<p class="detail">' + book.intro + '</p>' +
							'<p class="number">' +
							'<span>' + "点击量：" + book.count + '</span>' +
							'<span>更新：2019-10-21 00:10:55</span>' +
							'<span>字数：1386776</span>' +
							'</p>' +
							'<div class="action">' +
							'<a href="javascript:" class="order-btn" onclick="addShelft(1074345)" id="addShelfBtn1074345">放入书架</a>' +
							'</div>' +
							'</div>' +
							'</li>'
						$(".result-list>ul").append(row);
					});
					break;
				default:
					break;
			}
		},
	});
})

function to() {
	let bookUuid = $("#name").val()
	window.console.log(bookUuid)
	window.location.href = "1074345.html?bookUuid=" + bookUuid;
}